From: Daniel van Vugt Date: Thu, 6 Mar 2025 08:21:24 +0000 (+0800) Subject: keyboard: Silence 'Need keyval or commitString' error X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~143^2^2~9 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=52c2b0e507ef83b737fe4d619d6c962909dd5766;p=gnome-shell.git keyboard: Silence 'Need keyval or commitString' error Because it's not an error if the key has a GUI action that is not a key or commit. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7483 Part-of: --- diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index c8c6764ab..d07c18a59 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -227,7 +227,7 @@ const Key = GObject.registerClass({ }, }, class Key extends St.BoxLayout { _init(params, extendedKeys = []) { - const {label, iconName, commitString, keyval} = {keyval: 0, ...params}; + const {label, iconName, commitString, keyval, hasAction} = {keyval: 0, ...params}; super._init({style_class: 'key-container'}); this._keyval = parseInt(keyval, 16); @@ -243,6 +243,7 @@ const Key = GObject.registerClass({ this._extendedKeyboard = null; this._pressTimeoutId = 0; this._capturedPress = false; + this._hasAction = hasAction; } get iconName() { @@ -316,8 +317,8 @@ const Key = GObject.registerClass({ this.emit('keyval', this._keyval); else if (commitString) this.emit('commit', commitString); - else - console.error('Need keyval or commitString'); + else if (!this._hasAction) + console.error('Need keyval, commitString or an action'); } this.emit('released'); @@ -1002,7 +1003,7 @@ const EmojiSelection = GObject.registerClass({ row.appendRow(); - key = new Key({label: 'ABC'}, []); + key = new Key({label: 'ABC', hasAction: true}, []); key.keyButton.add_style_class_name('default-key'); key.connect('released', () => this.emit('toggle')); row.appendKey(key, 1.5); @@ -1017,7 +1018,7 @@ const EmojiSelection = GObject.registerClass({ section.button = key; } - key = new Key({iconName: 'osk-hide-symbolic'}); + key = new Key({iconName: 'osk-hide-symbolic', hasAction: true}); key.keyButton.add_style_class_name('default-key'); key.keyButton.add_style_class_name('hide-key'); key.connect('released', () => { @@ -1498,6 +1499,7 @@ export const Keyboard = GObject.registerClass({ label: key.label, iconName: key.iconName, keyval: key.keyval, + hasAction: !!key.action, }, strings); if (key.action) {